package com.untour.im.server.service.impl;

import com.untour.im.common.enums.ClientType;
import com.untour.im.common.enums.DeviceMultiLoginEnum;
import com.untour.im.server.dto.UserChannelInfo;
import com.untour.im.server.service.DeviceMultiLoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Slf4j
@Service
public class OneClientLoginServiceImpl extends AbstractDeviceMultiLoginServiceImpl implements DeviceMultiLoginService {
    @Override
    public DeviceMultiLoginEnum deviceMultiLogin() {
        return DeviceMultiLoginEnum.ONE;
    }

    @Override
    protected void removeUserChannel(List<UserChannelInfo> userChannels,
                                     ClientType clientType,
                                     Map<String, String> channelIdUserIdMap) {
        userChannels.forEach(uc -> super.removeChannelAndUserCache(channelIdUserIdMap, uc));
    }
}
